*** Settings ***
Library           RequestsLibrary
Library           Collections
Library           String

*** Test Cases ***
test1
    createsession    index    http://localhost:5001
    #admin查询
    ${param}    create dictionary    id=1
    ${res}    get request    index    /query    params=${param}
    ${jsondata}=    Evaluate    json.loads('''${res.text}''')    json
    ${data}=    Evaluate    json.dumps(${jsondata}, ensure_ascii=False, indent=2)    json
    log    ${data}

addadmin
    #admin添加
    createsession    index    http://localhost:5001
    ${time}    Get Time
    ${head}    create dictionary    content-type=application/json
    ${addadmin}    create dictionary    account=admin888    password=111111    rid=admin    createTime=${time}    describe=超级管理员    status=1
    ${res}    post request    index    /addadmin    data=${addadmin}    headers=${head}
    ${jsondata}=    Evaluate    json.loads('''${res.text}''')    json
    ${data}=    Evaluate    json.dumps(${jsondata}, ensure_ascii=False, indent=2)    json
    log    ${data}

deleteadmin
    #admin删除
    Create Session    index    http://localhost:5001
    ${id}    create dictionary    id=16
    ${res}    Delete Request    index    /deleteadmin    json=${id}
    ${jsondata}=    Evaluate    json.loads('''${res.text}''')    json
    ${data}=    Evaluate    json.dumps(${jsondata}, ensure_ascii=False, indent=2)    json
    log    ${data}

updateadmin
    #admin更新
    createsession    index    http://localhost:5001
    ${time}    Get Time
    ${head}    create dictionary    content-type=application/json
    ${updateadmin}    create dictionary    id=7    password=123456    rid=admin    createTime=${time}    describe=超级管理员    status=1    account=admin88
    ${res}    post request    index    /updateadmin    data=${updateadmin}    headers=${head}
    ${jsondata}=    Evaluate    json.loads('''${res.text}''')    json
    ${data}=    Evaluate    json.dumps(${jsondata}, ensure_ascii=False, indent=2)    json
    log    ${data}